package team.you.change.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import team.you.change.pojo.Course;
import team.you.change.util.Result;
import team.you.change.service.CourseService;

@Controller
@RequestMapping("/course")
public class CourseController {
    @Autowired
    private CourseService courseService;

    @RequestMapping("/getAllCourses")
    @ResponseBody
    private Result getAllCourses(Integer page, Integer limit)
    {
        return courseService.getAllCourses(page,limit);
    }
    @RequestMapping("/del")
    @ResponseBody
    private Result del(String id)
    {
        return courseService.del(id);
    }
    @RequestMapping("/delete")
    @ResponseBody
    private Result delete(String[] ids)
    {
        return courseService.delete(ids);
    }
    @RequestMapping("/update")
    @ResponseBody
    private Result update(Course course)
    {
        return courseService.update(course);
    }
    @RequestMapping("/add")
    @ResponseBody
    private Result add(Course course){
        return courseService.add(course);
    }
    @RequestMapping("/selectByLike")
    @ResponseBody
    private Result selectByLike(String value,Integer type,Integer page,Integer limit) {
        return courseService.selectByLike(value,type,page,limit);
    }
    @RequestMapping("/selCode")
    @ResponseBody
    private Result selCode(String code){
        return courseService.selCode(code);
    }
    @RequestMapping("/getCourseOption")
    @ResponseBody
    private Result getCourseOption(){
        return courseService.getCourseOption();
    }
}
